package com.example.todoapp.service;
import com.example.todoapp.data.entities.Tag;
import com.example.todoapp.data.TagRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
import java.util.List;

@Service
public class TagService {
    private final TagRepository tagRepository;

    @Autowired
    public TagService(TagRepository tagRepository) {
        this.tagRepository = tagRepository;
    }

    public List<Tag> getAllTags() {
        return tagRepository.findAll();
    }
    public Optional<Tag> getTagById(Long id) {
        return tagRepository.findById(id);
    }
}
